
from rest_framework import status
from rest_framework.generics import CreateAPIView
from rest_framework.response import Response
from rest_framework.views import APIView

from . import serializers
from .models import User


class CheckUsernameView(APIView):
    def get(self,request,username):

        count = User.objects.filter(username=username).count()

        data = {
            'count':count
        }

        return Response(data,status=status.HTTP_200_OK)


class CheckMobileView(APIView):
    def get(self,request,mobile):

        count = User.objects.filter(mobile=mobile).count()

        data = {
            'count': count,
        }

        return Response(data,status=status.HTTP_200_OK)


class RegisterUserView(CreateAPIView):
    serializer_class = serializers.RegisterUserSerializer

